package sample.swagger.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(value="A User Controller",tags = {"User Service"})
@RestController
public class UserController {

    @ApiOperation(value="Add User" ,notes="")
    @RequestMapping(value="/user/add",method = RequestMethod.POST)
    public String addUser(@ApiParam(name="username")@RequestParam(value="username") String username){
        System.out.println(username);
        return username +" add successfully";
    }

    @ApiOperation(value="Delete User" ,notes="")
    @RequestMapping(value="/user/delete",method = RequestMethod.POST)
    public String deleteUser(@ApiParam(name="username")@RequestParam(value="username") String username){
        System.out.println(username);
        return username +" delete successfully";
    }


    @ApiOperation(value="Show Objs" ,notes="")
    @RequestMapping(value="/user/showObjs",method = RequestMethod.POST)
    public String deleteUser(@ApiParam(name="objs")@RequestParam(value="objs") List objs){
        System.out.println(objs);
        return objs +" show successfully";
    }
}
